package com.woniuxy.hospital.service.impl;

import com.woniuxy.hospital.entity.HplPatient;
import com.woniuxy.hospital.mapper.HplPatientMapper;
import com.woniuxy.hospital.service.IHplPatientService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2021-08-12
 */
@Service
public class HplPatientServiceImpl extends ServiceImpl<HplPatientMapper, HplPatient> implements IHplPatientService {

    @Autowired
    private HplPatientMapper hplPatientMapper;

    /**
     * 根据患者Account查询患者信息
     * @param account
     * @return
     */
    @Override
    public HplPatient getByAccount(String account) {
        //判断患者Account是否合法，不合法直接返回null
        if (account==null || account.length()<6|| account.length()>12){
            return null;
        }else{
            //查询并返回患者信息
            return hplPatientMapper.getByAccount(account);
        }
    }
}
